package com.cec.controller.admin;

import com.cec.dto.CategoryDTO;
import com.cec.result.Result;
import com.cec.service.admin.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/admin")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;


    @PostMapping("/activityCategory/add")
    public Result addActivityCategory(@RequestBody CategoryDTO categoryDTO){
        log.info("addActivityCategory--> {}", categoryDTO);
        return categoryService.addActivityCategory(categoryDTO);
    }

    @PostMapping("/infoCategory/add")
    public Result addInfoCategory(@RequestBody CategoryDTO categoryDTO){
        log.info("addActivityCategory--> {}", categoryDTO);
        return categoryService.addInfoCategory(categoryDTO);
    }

    @PutMapping("/activityCategory/update")
    public Result updateActivityCategory(@RequestBody CategoryDTO categoryDTO){
        log.info("addActivityCategory--> {}", categoryDTO);
        return categoryService.updateActivityCategory(categoryDTO);
    }

    @PutMapping("/infoCategory/update")
    public Result updateInfoCategory(@RequestBody CategoryDTO categoryDTO){
        log.info("addActivityCategory--> {}", categoryDTO);
        return categoryService.updateInfoCategory(categoryDTO);
    }

    @DeleteMapping("/activityCategory/{id}")
    public Result deleteActivityCategory(@PathVariable Integer id){
        return categoryService.deleteActivityCategory(id);
    }

    @DeleteMapping("/infoCategory/{id}")
    public Result deleteInfoCategory(@PathVariable Integer id){
        return categoryService.deleteInfoCategory(id);
    }
}
